@namespace Oqtane.Themes.OqtaneTheme
@inherits ContainerBase
@inject ISettingService SettingService

<div class="@_classes">
    @if (_title && ModuleState.Title != "-")
    {
        <div class="row px-4">
            <div class="d-flex flex-nowrap">
                <ModuleActions /><h2><ModuleTitle /></h2>
            </div>
            <hr class="app-rule" />
        </div>
    }
    else
    {
        <ModuleActions />
    }
    <div class="row px-4">
        <div class="container-fluid">
            <ModuleInstance />
        </div>
    </div>
</div>

@code {
    public override string Name => "Customizable Container";

    private bool _title = true;
    private string _classes = "container-fluid";

    protected override void OnParametersSet()
    {
        try
        {
            _title = bool.Parse(SettingService.GetSetting(ModuleState.Settings, GetType().Namespace + ":Title", "true"));
            _classes += " " + SettingService.GetSetting(ModuleState.Settings, GetType().Namespace + ":Background", "");
            _classes += " " + SettingService.GetSetting(ModuleState.Settings, GetType().Namespace + ":Text", "");
            _classes += " " + SettingService.GetSetting(ModuleState.Settings, GetType().Namespace + ":Border", "");
            _classes = _classes.Trim();
        }
        catch
        {
            // error loading container settings
        }
    }
}